package com.zhu.salesmanagement.network;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.xmlrpc.android.XMLRPCClient;

import com.zhu.salesmanagement.common.Actions;

import android.util.Log;

public class PostMethod {

	public static final String CALL_LOGIN = "dmsmobile.getSalespersonSC";
	public static final String CALL_PRODUCTCATEGORY = "dmsmobile.getProductCategorySC";
	public static final String CALL_PRODUCT= "dmsmobile.getProductSC";
	public static final String CALL_REMIND = "dmsmobile.getRemindMSGSC";
	public static final String CALL_TASKLIST = "dmsmobile.getDatingTaskListSC";
	public static final String CALL_CUSTOMER= "dmsmobile.getCustomerSC";
	public static final String CALL_CUSTOMERSHELF= "dmsmobile.getProductCategoryAndCustomerShelfOfCustomersSC";
	public static final String CALL_ISTANDARD= "dmsmobile.getIntegrationStandard";
	public static final String CALL_CRC= "dmsmobile.getDatingTaskActualCRCOfCustomersSC";
	public static final String CALL_CRCOTHER= "dmsmobile.getDatingTaskActualOtherOfCustomersSC";
	public static final String CALL_SCMSG= "dmsmobile.getDatingTaskActualMSG";
	public static final String CALL_PUSHERSTORE= "dmsmobile.getPusherstoreOfCustomersSC";
	public static final String POST_VISITEDTASK = "dmsmobile.putDatingTaskActualSC";
	public static final String POST_CUSTOMERSHELF= "dmsmobile.putCustomerShelfSC";
	public static final String POST_VISITEDTASKEXHIBITION = "dmsmobile.putDatingTaskActualExhibition";
	public static final String POST_DTASKACTUALINTEGRATION = "dmsmobile.putDatingTaskActualIntegration";
	public static final String POST_DTASKACTUALIMPORTMSG = "dmsmobile.putDatingTaskActualMSG";
	public static final String POST_DTASKACTUALPHOTO = "dmsmobile.putDatingTaskActualPhotoSC";
	public static final String POST_STOREPROPERTY= "dmsmobile.putStorePropertyInquireSC";
	public static final String POST_ADDEDNEWSTORES = "dmsmobile.putCustomerTempSC";
	public static final String POST_COMPLETETED= "dmsmobile.isCompleted";
	public static final String CALL_NEARCUSTOMERS= "dmsmobile.getNearCustomerSC";
	public static final String CALL_SALESOFFICE = "dmsmobile.getEmployeeSalesOfficeSC";
	public static final String CALL_SALESOFFICECUSTOMERS = "dmsmobile.getSalesOfficeCustomerSC";
	public static final String CALL_CITYCUSTOMER = "dmsmobile.getCityCustomerSC";
	public static final String CALL_PROVINCESC = "dmsmobile.getProvinceSC";
	public static final String CALL_CITYSC = "dmsmobile.getCitySC";

	public static final String CALL_UPDATECUSTOMERSHELF= "dmsmobile.getProductCategoryOfCustomers";
	public static final String POST_VISITEDTASKOTHER = "dmsmobile.putDatingTaskActualOther";
	public static final String POST_CUSTOMERCLOSE= "dmsmobile.putCustomerClosed";
	public static final String CALL_NETWORKTIME= "dmsmobile.getNetworkTime";
	

	public static void requesLogin(String name, String password, boolean isFirst, String version, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_LOGIN, callback, client);
    	if(Actions.DEBUG){
    		Log.e("zhu","isFirst="+isFirst);
    	}
    	Object[] params = { name, password, isFirst ? 1 : 0, version};
        method.call(params);
	}

	public static void requesCustomer(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CUSTOMER, callback, client);
        Object[] params = new Object[]{ eid, uuid, list};
        method.call(params);
    }

	public static void requesProductCategory(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PRODUCTCATEGORY, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	public static void requesProducts(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PRODUCT, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	public static void requesCustomerShelfs(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CUSTOMERSHELF, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requesCRC(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CRC, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requesCRCOther(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CRCOTHER, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requesPusherStore(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PUSHERSTORE, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requesSCMsg(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_SCMSG, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requesUpdateCustomerPC(String eid, String uuid, boolean isFirst, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_UPDATECUSTOMERSHELF, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }

	public static void requesMyTaskList(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_TASKLIST, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }


	public static void requesRemindMsg(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_REMIND, callback, client);
    	Object[] params = { eid, uuid };
        method.call(params);
	}

	public static void postNewStores(String eid, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_REMIND, callback, client);
    	 Map<String, Object> map = new HashMap<String, Object>();
         map.put("sEmployeeID", eid);
    	Object[] params = { map };
        method.call(params);
	}

	public static void postCustomerShelf(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_CUSTOMERSHELF, callback, client);
        method.call(params);
	}

	public static void postDatingTaskActual(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_VISITEDTASK, callback, client);
        method.call(params);
	}

	public static void putDatingTaskActualExhibition(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_VISITEDTASKEXHIBITION, callback, client);
        method.call(params);
	}
	
	public static void putDatingTaskActualIntegration(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_DTASKACTUALINTEGRATION, callback, client);
        method.call(params);
	}

	public static void putDatingTaskActualImportMsg(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_DTASKACTUALIMPORTMSG, callback, client);
        method.call(params);
    }

	public static void putDatingTaskActualPhoto(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_DTASKACTUALPHOTO, callback, client);
        method.call(params);
    }

	public static void postNewAddedStores(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_ADDEDNEWSTORES, callback, client);
        method.call(params);
	}

	public static void postCustomerClose(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_CUSTOMERCLOSE, callback, client);
        method.call(params);
	}

	public static void postStoreProperty(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_STOREPROPERTY, callback, client);
        method.call(params);
    }

	public static void postCompeleted(Object[] params, XMLRPCMethodCallback callback, XMLRPCClient client){
    	XMLRPCMethod method = new XMLRPCMethod(PostMethod.POST_COMPLETETED, callback, client);
        method.call(params);
	}

	public static void requestNetworkTime(String eid, String uuid, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_NETWORKTIME, callback, client);
        Object[] params = { eid, uuid };
        method.call(params);
    }

	public static void requestIntegrationStandard(String eid, String uuid, List<String> list, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_ISTANDARD, callback, client);
        Object[] params = { eid, uuid, list};
        method.call(params);
    }

	public static void requestNearCustomers(String eid, String uuid, double lng, double lat, int raidus, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_NEARCUSTOMERS, callback, client);
        Object[] params = { eid, uuid, lng, lat, raidus};
        method.call(params);
    }

	public static void requestEmployeeSalesOfficeSC(String eid, String uuid,  XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_SALESOFFICE, callback, client);
        Object[] params = { eid, uuid};
        method.call(params);
    }

	public static void requestProvinceSC(String eid, String uuid,  XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_PROVINCESC, callback, client);
        Object[] params = { eid, uuid};
        method.call(params);
    }

	public static void requestCitySC(String eid, String uuid, String provinceID, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CITYSC, callback, client);
        Object[] params = { eid, uuid, provinceID};
        method.call(params);
    }

	public static void requestEmployeeSalesOfficeCustomerSC(String eid, String uuid, String officeID, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_SALESOFFICECUSTOMERS, callback, client);
        Object[] params = { eid, uuid, officeID};
        method.call(params);
    }
	
	public static void requestCityCustomerSC(String eid, String uuid, String cityID, XMLRPCMethodCallback callback, XMLRPCClient client){
        XMLRPCMethod method = new XMLRPCMethod(PostMethod.CALL_CITYCUSTOMER, callback, client);
        Object[] params = { eid, uuid, cityID};
        method.call(params);
    }
	
}
